package com.shxc.smarttrade.kvb.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.shxc.smarttrade.R;
import com.shxc.smarttrade.base.BaseFragment;
import com.shxc.smarttrade.kvb.activity.KvbOpenAccountActivity;
import com.shxc.smarttrade.screenshot.ScreenShotActivity;
import com.shxc.smarttrade.utils.Loger;
import com.shxc.smarttrade.utils.ToastUtils;

import org.xchris.view.annotation.ContentView;
import org.xchris.view.annotation.Event;
import org.xchris.view.annotation.ViewInject;

import java.io.File;
import java.io.FileOutputStream;

/**
 * KVB开户 四.开户完成
 */
@ContentView(R.layout.fragment_kvb_4)
public class KvbOpen4Fragment extends BaseFragment {

    @ViewInject(R.id.account_textview)
    TextView account_textview;
    @ViewInject(R.id.pass_textview)
    TextView pass_textview;
    @ViewInject(R.id.saveimg_textview)
    Button saveimg_textview;
    @ViewInject(R.id.finish_button)
    Button finish_button;

    KvbOpenAccountActivity kvbOpenAccountActivity;

    String account;
    String password;


    public static KvbOpen4Fragment newInstance(String account,String password) {
        KvbOpen4Fragment frag = new KvbOpen4Fragment();
        Bundle args = new Bundle();
        args.putString("account", account);
        args.putString("password", password);
        frag.setArguments(args);
        return frag;
    }

    @Event({R.id.saveimg_textview, R.id.finish_button})
    private void onClick(View view) {
        switch (view.getId()) {
            case R.id.saveimg_textview:
                //截屏
                Loger.e("截屏","截屏1");
                startActivity(new Intent(getActivity(), ScreenShotActivity.class));
                Loger.e("截屏","截屏2");
                break;
            case R.id.finish_button:
                //关闭当前页
                getActivity().finish();
                break;
        }
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        kvbOpenAccountActivity = (KvbOpenAccountActivity) getActivity();

        account = getArguments().getString("account");
        password = getArguments().getString("password");

        account_textview.setText(account);
        pass_textview.setText(password);

    }
}
